package com.first.common.vo;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @program: finrsteducation-parent
 * @description: vo视图
 * @author: 张玉森
 * @create: 2023-05-22 19:39
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@TableName("Result")
@ApiModel(value = "Result对象",description = "")
public class Result {
    @ApiModelProperty("状态码 200表示成功 500表示失败 401表示权限不足 402表示未登录")
    private Integer code;
    @ApiModelProperty("响应的消息")
    private String msg;
    @ApiModelProperty(value = "响应的数据")
    private Object data;

    public static Result success(){
        return new Result(200, "成功",null);
    }
    public static Result success(Object data){
        return new Result(200, "成功",data);
    }
    public static Result success(String msg,Object data){
        return new Result(200, msg,data);
    }
    public static Result fail(){
        return new Result(500, "失败",null);
    }

    public static Result fail(String msg){
        return new Result(500, msg,null);
    }
}
